/*
 * @Author: cooper
 * @Date: 2025-04-03 21:29:22
 * @Wechat: cmd_develop
 * @Description:
 */
#ifndef __REGKEY
#define __REGKEY
#include <common.h>
void reg_init(void);

#define WAITTIME 1000 // 超时设置

#define ARM_KEYS_NUM 30       // 已知的键数量
#define ARM_LONG_KEYS_NUM 30  // 已知的键数量
#define ARM_SHORT_KEYS_NUM 30 // 已知的键数量
#define ARM_Z_KEYS_NUM 30     // 已知的键数量
#define ARM_PAW_KEYS_NUM 30   // 已知的键数量
#define ARM_STICK_KEYS_NUM 30 // 已知的键数量

#define LIFT_KEYS_NUM 30
#define LIFT_UPDOWN_KEYS_NUM 30
#define LIFT_DOOR_KEYS_NUM 30

#define FOOD_KEYS_NUM 30
#define FOOD_ONE_KEYS_NUM 30
#define FOOD_TWO_KEYS_NUM 30
#define FOOD_THREE_KEYS_NUM 30
#define FOOD_FOUR_KEYS_NUM 30

extern unsigned int ARM_REG[ARM_KEYS_NUM];
extern unsigned int LONG_ARM_REG[ARM_LONG_KEYS_NUM];
extern unsigned int SHORT_ARM_REG[ARM_SHORT_KEYS_NUM];
extern unsigned int Z_ARM_REG[ARM_Z_KEYS_NUM];
extern unsigned int PAW_ARM_REG[ARM_PAW_KEYS_NUM];
extern unsigned int STICK_ARM_REG[ARM_STICK_KEYS_NUM];

extern unsigned int LIFT_REG[LIFT_KEYS_NUM];
extern unsigned int UPDOWN_LIFT_REG[LIFT_UPDOWN_KEYS_NUM];
extern unsigned int DOOR_LIFT_REG[LIFT_DOOR_KEYS_NUM];

extern unsigned int FOOD_REG[FOOD_KEYS_NUM];
extern unsigned int ONE_FOOD_REG[FOOD_ONE_KEYS_NUM];
extern unsigned int TWO_FOOD_REG[FOOD_TWO_KEYS_NUM];
extern unsigned int THREE_FOOD_REG[FOOD_THREE_KEYS_NUM];
extern unsigned int FOUR_FOOD_REG[FOOD_FOUR_KEYS_NUM];

typedef enum
{
    REG_STATUS,
    REG_SPEED,
    REG_ACC,
    REG_ERROR_TIMES,
    REG_POS_0,
    REG_POS_1,
    REG_POS_2,
    REG_POS_3,
    REG_POS_4,
    REG_POS_5,
    REG_POS_6,
    REG_POS_7,
    REG_POS_8,
    REG_POS_9,
    REG_POS_10,
    REG_POS_11,
    REG_POS_12,
    REG_POS_13,
    REG_POS_14,
    REG_POS_15,
    REG_POS_16,
    REG_POS_17,
    REG_POS_18
} Reg_key;

typedef enum
{
    KW_FREE_STATE, // 空闲
    KW_HEAT_STATE, // 加热
    KW_KEEP_STATE  // 保温
} Temputure_key;

// 烤位情况
typedef struct
{
    u8 priority;        /* 烤制优先级 数字越小越优先*/
    u8 long_pos;        /* 长轴定位 */
    u8 short_pos;       /* 短轴定位 */
    u8 right_pos;       /* 右烤位 */
    u8 left_pos;        /* 左烤位 */
    u8 right_pipe;      /* 右烤管 */
    u8 left_pipe;       /* 左烤管 */
    u8 state;           // 当前状态,0空闲,1烤制,2保温
    u8 taste;           // 烤制口味
    u16 cur_temputure;  // 当前温度
    u16 bake_temputure; // 烤制温度
    u16 bake_time;      // 烤制时间
    u16 keep_temputure; // 保温温度
} bakepos_config;
#define BAKEPOS_TOTAL 28 // 一共多少个烤位
extern bakepos_config BP_CONFIG[BAKEPOS_TOTAL];

#endif
